package edu.stanford.prpl.common.util;

import static edu.stanford.prpl.common.PRPLConstants.PRPL_X_REQUEST_DEFAULT_TIMEOUT;

import java.net.URL;

//import org.apache.xmlrpc.client.XmlRpcClient;
//import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
//import org.apache.xmlrpc.client.util.ClientFactory;

public class XmlRpcUtils {

	/*public static <C> C getXmlRpcClientForInterface(URL url, String userName, Class interfacez) {

		XmlRpcClient xmlRpcClient = getXmlRpcClient(url, userName);
		ClientFactory factory = new ClientFactory(xmlRpcClient);
		C client = (C) factory.newInstance(interfacez);
		return client;
	}

	public static XmlRpcClient getXmlRpcClient(URL url, String userName) {

		XmlRpcClientConfigImpl xmlRpcClientConfig = new XmlRpcClientConfigImpl();
		xmlRpcClientConfig.setServerURL(url);
		xmlRpcClientConfig.setBasicUserName(userName);
		xmlRpcClientConfig.setEnabledForExtensions(true);
		xmlRpcClientConfig.setContentLengthOptional(true);
		xmlRpcClientConfig.setConnectionTimeout(PRPL_X_REQUEST_DEFAULT_TIMEOUT);
		xmlRpcClientConfig.setReplyTimeout(PRPL_X_REQUEST_DEFAULT_TIMEOUT);

		XmlRpcClient xmlRpcClient = new XmlRpcClient();
		xmlRpcClient.setConfig(xmlRpcClientConfig);

		return xmlRpcClient;
	}*/
}
